﻿/*
 声音进度条录制时需要；
 
 */

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace Common
{ /// <summary>
  /// 傅立叶变换。
  /// </summary>
    public static class ClassMyFile
    {
        public static void WriteLog(string text, string filename)
        {

            string path = AppDomain.CurrentDomain.BaseDirectory;
            path = System.IO.Path.Combine(path
            , "Logs\\");

            path = System.IO.Path.Combine(path
           , "Logs\\" + DateTime.Now.ToString("yyyyMM")+ "\\" + DateTime.Now.ToString("dd")+ "\\");


            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            string fileFullName = System.IO.Path.Combine(path
            , string.Format("{0}_{1}.txt", filename, DateTime.Now.ToString("yyyyMMdd")));


            using (StreamWriter output = System.IO.File.AppendText(fileFullName))
            {
                
                output.WriteLine(DateTime.Now.ToString("MM-dd HH:mm:ss:fff")+" " +text);

                output.Close();
            }
        }


        public static void WriteLog2(string text, string filename)
        {

            string path = AppDomain.CurrentDomain.BaseDirectory;
            path = System.IO.Path.Combine(path
            , "Logs\\");

            path = System.IO.Path.Combine(path
           , "Logs\\" + DateTime.Now.ToString("yyyyMM") + "\\" + DateTime.Now.ToString("dd") + "\\");


            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            string fileFullName = System.IO.Path.Combine(path
            , string.Format("{0}_{1}.txt", filename, DateTime.Now.ToString("yyyyMMdd-HH")));


            using (StreamWriter output = System.IO.File.AppendText(fileFullName))
            {

                output.Write(text);

                output.Close();
            }
        }

    }
}
